import React, { Component } from 'react'
import './content.css'
export default class Content extends Component {
  render() {
    let {userData,isFirst,isLoading,errorMsg} = this.props
    console.log('this.props: ', this.props);
    return (
    <div className='user-wrapper'>
        {
          isFirst ? <h2 className='nodata'>暂无数据， 请搜索...</h2> :
          isLoading ? <h2 className='loading'>拼命加载中...</h2>:
          errorMsg ? <h2 className='error-msg'>errorMsg</h2> :
              userData.map(user => {
                return (
                  <div className='user-item' key={user.id}> 
                  <img src={user.avatar_url ? user.avatar_url :'https://avatars.githubusercontent.com/u/20520380?v=4'} alt="" className='avatar' />
                  <a className='user-name'>{user.login}</a>
                </div>
                )
              })
        }
    </div>
    )
  }
}
